//根据用户查询商店
function selectStoreByUser(userId, callback) {
    $.ajax({
        type: 'post',
        url: '/store/selectStoreOfUser',
        data: {
            userId: userId
        }
        ,success: function (result) {
            if(result.code === "SUCCESS") {
                callback(result.data);
            } else {
                alert(result.errMsg);
            }
        }
        ,error: function(error) {
            if (error != null && error.status === 401) {
                alert("请先登录");
                location.href = "/login.html";
            } else {
                alert("内部错误");
            }
        }
    });
}
//根据id查询商铺
function selectStoreById(storeId, callback) {
    $.ajax({
        type: 'post',
        url: '/store/selectById',
        data: {
            storeId: storeId
        }
        ,success: function(result) {
            if(result.code === "SUCCESS") {
                callback(result.data);
            } else {
                alert(result.errMsg);
            }
        }
        ,error: function(error) {
            if (error != null && error.status === 401) {
                alert("请先登录");
                location.href = "/login.html";
            } else {
                alert("内部错误");
            }
        }
    });
}

function selectStoreByUserIdAndStoreId(userId, storeId, callback) {
    $.ajax({
        type: 'post',
        url: '/store/selectById',
        data: {
            userId: userId,
            storeId: storeId
        }
        ,success: function(result) {
            if(result.code === "SUCCESS") {
                callback(result.data);
            } else {
                alert(result.errMsg);
            }
        }
        ,error: function(error) {
            if (error != null && error.status === 401) {
                alert("请先登录");
                location.href = "/login.html";
            } else {
                alert("内部错误");
            }
        }
    });
}
